<?php
namespace app\admin\controller\order;
use app\admin\controller\order\service\OrderDrive;
use app\common\controller\Admin;
use app\common\traits\ControllerCurd;
use think\Request;
use app\common\annotation\NodeAnnotation;
/**
 * @NodeAnnotation(
 *     title="订单系统配置",
 *     parent="admin/order.index",
 *     is_menu=0,
 *     is_view=0,
 *     auth=1
 * )
 */
class Setting extends Admin
{
    /**
     * @NodeAnnotation(
     *     title="设置管理",
     *     parent="admin/order.setting",
     *     MenuRoot="admin/order.index"
     * )
     */
    public function set(Request $request)
    {
        $setting = get_option("order_setting");
        if ($request->isPost())
        {
            $setting = $this->request->post();
            set_option("order_setting",$setting);
            $this->success('设置成功！');
        }
        /*$app = new OrderDrive();
        $product = [
            'product_name' => '产品测试',
            'price' => 0.01,
            'trade_type' => "NATIVE",
            'notify_url' => url("index/index/pay_test",'','',true)
        ];
        echo "<img src='". $app->place_order($product)."'>";*/
        $this->assign([
            "setting" => $setting
        ]);
        return $this->fetch();
    }


}